#{extends 'CRUD/layout.html' /}
<head>
<script type="text/javascript"
	src="/../../../public/javascripts/jquery.min.js"></script>
<script type="text/javascript"
	src="/../../../public/javascripts/jquery-ui.min.js"></script>
<script type="text/javascript">
	function AssignRole() {
		var ideaDeveloper = document.getElementById("ideaDeveloper").value;
		var role = document.getElementById('role').options[document
				.getElementById('role').selectedIndex].value;
		var name = document.getElementById("name").value;
		
		document.getElementById("ideadev").innerHTML = "";
		document.getElementById("nm").innerHTML = "";
		
		var errors = 0;
		if (ideaDeveloper.length === 0) {
			document.getElementById("ideadev").innerHTML = "Please enter an idea developer's username";
			errors = errors + 1;
		}
		if (name.length === 0) {
			document.getElementById("nm").innerHTML = "Please enter to what will the idea developer be assigned to";
			errors = errors + 1;
		}
		if (errors > 0) {
			return false;
		} else {
			$.getJSON('@{SystemAdmin.assign()}', {
				'username' : ideaDeveloper,
				'roleType' : role,
				'name' : name
			}, function(data) {
				alert(data.output)
			});
		}
	}
</script>

</head>
<body>
	<style>
.inputHighlighted {
	color: #ff0000;
}
</style>
	<div>
		<p>
			<label for="IdeaDeveloper" id="labelIdeaDeveloper">
				IdeaDeveloper: </label> <input name="ideaDeveloper" value="" type="text"
				id="ideaDeveloper"><span class="inputHighlighted">*</span><span
				class="inputHighlighted" id="ideadev"></span>
		</p>
		<p>
			<label for="Role" id="labelRole"> Role: </label> <select name="role"
				id="role">
				<option value="organizationLead" selected="selected">Organization
					Lead</option>
				<option value="organizerEntity">Organizer to Entity</option>
				<option value="organizerTopic">Organizer to Topic</option>
			</select><span class="inputHighlighted">*</span>
		</p>
		<p>
			<label for="name" id="labelname"> Organization/Entity/Topic
				Name: </label> <input name="name" value="" type="text" id="name"><span
				class="inputHighlighted">*</span><span class="inputHighlighted"
				id="nm"></span>
		</p>
		<input type="button" id="assignRoles" value="Assign Roles"
			onClick="AssignRole()" />
	</div>


</body>